package cn.com.yang.egg;

/**
 * @Author 杨亿金
 * @Date 2022/2/5 22:19
 * @CopyRight
 * @Version
 */
public class DoubleCheckLazySingleton {
    private volatile static DoubleCheckLazySingleton singleton= null;

    private DoubleCheckLazySingleton(){}

    public static DoubleCheckLazySingleton newInstance(){
        if (singleton==null){
            synchronized (DoubleCheckLazySingleton.class){
                if (singleton==null){
                    singleton = new DoubleCheckLazySingleton();
                }
            }
        }
        return singleton;
    }
}
